<!doctype html>
<html lang="zh-cn">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>placeholder-shown与not</title>
</head>
<style>
  .g-container {
    position: relative;
    margin: 100px auto;
    display: flex;
    flex-wrap: wrap;
    width: 500px;
    height: 60px;
    overflow: hidden;
    transition: 0.3s;
  }
  .g-container > * {
    border: none;
    outline: none;
  }
  .g-container .g_input_search {
    padding: 0 15px;
    height: 100%;
    width: 100%;
    border: 1px solid #ddd;
    font-size: 18px;
    box-sizing: border-box;
  }
  .g-container .g_input_search:not(:placeholder-shown) {
    /* 当有内容时 */
    border: 1px solid #03a9f4;
  }
  .g-container .g_input_search:not(:placeholder-shown) + .g_button_search {
    opacity: 1;
  }
  .g-container .g_input_search:placeholder-shown {
    /* 没内容时 */
  }
  .g-container .g_input_search:placeholder-shown + .g_button_search {
    opacity: 0;
  }
  .g-container .g_button_search {
    background: #03a9f4;
    color: #feffd4;
    font-size: 15px;
    cursor: pointer;
    width: 100px;
    height: calc(100% - 20px);
    transition: 0.3s;
    position: absolute;
    right: 10px;
    top: 10px;
  }
  .g-container:focus-within {
    transform: translateY(-4px);
    border-color: #bbb;
    box-shadow: 4px 4px 10px 2px #ddd;
  }

</style>
<body>
<p>
  placeholder-shown应用与placeholder属性,
  也就是说placeholder-shown只会选中没内容的框（.g_input_search:placeholder-shown），相反地：
  选中有内容的框（.g_input_search:not(:placeholder-shown)）
</p>
<div class="g-container">
  <input type="text" placeholder="输入你想查询的内容" class="g_input_search" >
  <button type="button" class="g_button_search">GO</button>
</div>
</body>
</html>
